<?if($data->like == 'platonic'):?>
<li><a id="like" href="javascript:likeback();"><?=dgettext('like','Like back')?></a>
<?elseif($data->like == 'match'):?>
<li><a id="like" href="javascript:unlike();"><?=dgettext('like','Unlike')?></a>
<?elseif($data->like == 'awaiting'):?>
<li><a id="like"><?=dgettext('like','Awaiting reply')?></a>
<?elseif(!$data->settings->like || $data->settings->like->request):?>
<li><a id="like" href="javascript:like();"><?=dgettext('like','Like')?></a>
<?endif;?>
<script type="text/javascript">
function like(){
	tool.confirm('<?=dgettext("like","Confirm")?>','<?=dgettext("like","Are you sure you want to `like` this member?")?>','_like()');
}
function _like(){
	tool.post({'url':'/json/like/like',
		'data':'accountID=<?=$data->profile->ID?>',
		'onComplete':function(e){
			if(e.code==200)	{
				$('#like').attr({'href':'javascript:unlike();'}).html('<?=dgettext("like","Unlike")?>');
				return tool.result(200,'<?=dgettext("like","Successfull")?>','<?=dgettext("like","Your like has been sent.")?>');
			}
			else return tool.result(400,'<?=dgettext("like","Alert")?>','<?=dgettext("like","Please try again later..")?>');
		}
	});
}
function likeback(){
	tool.confirm('<?=dgettext("like","Confirm")?>','<?=dgettext("like","Are you sure you want to `like back` this member?")?>','_likeback()');
}
function _likeback(){
	tool.post({'url':'/json/like/likeback',
		'data':'accountID=<?=$data->profile->ID?>',
		'onComplete':function(e){
			if(e.code==200)	$('#like').attr({'href':'javascript:unlike();'}).html('<?=dgettext("like","Unlike")?>');
			else return tool.result(400,'<?=dgettext("like","Alert")?>','<?=dgettext("like","Please try again later..")?>');
		}
	});
}
function unlike(){
	tool.confirm('<?=dgettext("like","Confirm")?>','<?=dgettext("like","Are you sure you want to `unlike` this member?")?>','_unlike()');
}
function _unlike(){
	tool.post({'url':'/json/like/unlike',
		'data':'accountID=<?=$data->profile->ID?>',
		'onComplete':function(e){
			if(e.code==200)	$('#like').attr({'href':'javascript:like();'}).html('<?=dgettext("like","Like")?>');
			else return tool.result(400,'<?=dgettext("like","Alert")?>','<?=dgettext("like","Please try again later..")?>');
		}
	});
}
</script>